package com.asseco.mio.core.webapp.controller;

import org.appfuse.model.Role;
import org.appfuse.service.GenericManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;

@Controller
@RequestMapping("/roles*")
public class RoleController {
    private GenericManager<Role, Long> roleManager;

    @Autowired
    public void setRoleManager(@Qualifier("roleManager") GenericManager<Role, Long> roleManager) {
        this.roleManager = roleManager;
    }

    @RequestMapping(method = RequestMethod.GET)
    public ModelAndView handleRequest()
    throws Exception {
        return new ModelAndView().addObject(roleManager.getAll());
    }
}
